package com.siwei.mes.enums;

import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;

import java.util.Arrays;

/**
 * 配置类型
 *
 * @Description: 运单状态
 * @Version: 1.0
 * @author: yangke
 * @date: 2024/06/19 22:31
 */
@Getter
public enum WaybillStateEnum {
    INVALIDATE(0, "作废"),
    WAIT_APPOINTMENT (1, "待预约"),
    WAIT_TO(2, "待出发"),
    WAIT_FROM(3, "待到达"),
    WAIT_WEIGH(4, "待过磅"),
    WEIGHING(5, "过磅中"),
    WAIT_VERB(6, "等待卸料"),
    UNLOADING(7, "卸料中"),
    WAIT_STAGE(8, "等待出场"),
    DONE(9, "已完成"),
    REJECTION(10, "拒收");

    @ApiModelProperty(value = "运单状态")
    private Integer code;
    @ApiModelProperty(value = "状态名称")
    private String name;

    WaybillStateEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    /**
     * 根据code查找信息
     *
     * @return
     */
    public static WaybillStateEnum selectByCode(Integer code) {
        return Arrays.stream(values()).filter(e -> e.getCode().equals(code)).findFirst().orElse(null);
    }
}
